import QtQuick 2.0
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import "qrc:///MyControls"

Popup{
    x: 100
    y: 100
    width: 200
    height: 200
    modal: true
    focus: true
    closePolicy: Popup.CloseOnPressOutside
    margins: 10
    anchors.centerIn: parent

    signal levelChanged(int level)

    background: Rectangle{
        color: CTheme.background
        radius: CTheme.dialogRadius
    }

    ColumnLayout{
        anchors.fill: parent

        Repeater{
            model: listModel
            CButton{
                Layout.alignment: Qt.AlignHCenter
                id:btnEasy
                text: btnText
                width:80
                height: 40
                onClicked: {
                    levelChanged(level);
                    close();
                }
            }
        }

    }

    ListModel{
        id:listModel
        ListElement{btnText:"一般";level:0}
        ListElement{btnText:"困难";level:1}
        ListElement{btnText:"地狱";level:2}
    }
}
